<!-- 组件说明 -->
<template>
    <div class='product'>
        <el-row>
            <el-col :span="24" class="probanner">
            </el-col>
        </el-row>
        <el-row :gutter="20" style="margin-top:20px">
            <el-col :span="4" :offset="2" style="padding:0;width: 240px;">
                <el-menu  :default-active="defaultPro" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose">
                    <el-submenu class="types" :index="item.id" v-for="(item) in dropMenuArr" :key="item.id">
                        <template slot="title">
                            <span class="protitle">{{item.catename}}</span>
                        </template>
                        <el-submenu  v-for="(subitem) in item.child" :index="item.id+'-'+subitem.id" :key="subitem.id">
                            <template slot="title" >{{subitem.catenametwo}}</template>
                            <el-menu-item v-for="(childitem) in subitem.child" :index="item.id+'-'+subitem.id+'-'+childitem.id" :key="childitem.id" @click="getFirstMenu(childitem.title,childitem.content,item.id)">{{childitem.title}}</el-menu-item>
                        </el-submenu>
                    </el-submenu>
                </el-menu>
            </el-col>
            <el-col :span="16">
                <el-row :gutter="20">
                    <el-col :span="20">
                        <div class="titlecribe" >{{titledescribe}}</div>
                    </el-col>
                </el-row>
                <el-divider></el-divider>
                <el-row :gutter="20">
                    <el-col :span="20">
                        <el-breadcrumb separator-class="el-icon-arrow-right">
                            <el-breadcrumb-item >首页</el-breadcrumb-item>
                            <el-breadcrumb-item >产品与解决方案</el-breadcrumb-item>
                            <el-breadcrumb-item >{{producttitle}}</el-breadcrumb-item>

                            <el-breadcrumb-item >{{titledescribe}}</el-breadcrumb-item>
                        </el-breadcrumb>
                    </el-col>
                </el-row>
                <div id="procontent" style="padding:10px;text-align:left">

                </div>
            </el-col>
        </el-row>
        <common-footer style="margin-top: 50px;"></common-footer>
    </div>
</template>

<script>
    import Bus from '../request/bus'
    import {getProductList} from '@/request/api'
    import CommonFooter from '../components/common/Footer'
    export default {
        components: {
            CommonFooter
        },
        data () {
            return {
                titledescribe:'国产化OA产品',
                dropMenuArr:[],
                dlproduct:[],
                serviceArr:[],
                producttitle:'解决方案',
                defaultPro: "1",
            };
        },
        computed: {

        },
        methods: {

            //面包屑导航点击事件
            breadClick(tag){
                if(tag == "main"){
                    Bus.$emit('main');
                }else if(tag == "product"){
                    Bus.$emit('looksolution');
                }else if(tag == "title"){
                    this.defaultPro = '1-0'
                }
            },
            getProductWork(){
                getProductList().then(res=>{
                  /*  console.log(JSON.stringify(res)+'12312');*/
                    this.dropMenuArr = res;
                    this.serviceArr = res.servicSupport;
                    this.getFirstMenu(res[0].child[0].child[0].title,res[0].child[0].child[0].content,'0');
                    Bus.$on('looksolution', val=>{
                    // console.log("兄弟组件",val)
                    for(let i=0;i<res.length;i++){

                      for(let j =0;j<res[i].child.length;j++){

                        for(let q=0;q<res[i].child[j].child.length;q++){
                          if(val==res[i].child[j].child[q].title){
                            console.log(res[i].child[j].child[q].title)
                            this.getFirstMenu(res[i].child[j].child[q].title,res[i].child[j].child[q].content,'0');
                          }

                        }

                      }

                    }
                  });
                })
            },
            getFirstMenu(title,content,index){
                this.titledescribe = title;
                document.getElementById("procontent").innerHTML = content;
                if(index=="3"){
                    this.producttitle = '解决方案'
                }else if(index=="1"){
                    this.producttitle = "自主产品"
                }else{
                    this.producttitle = '服务支持'
                }
            },
            handleOpen(val){
            },
            handleClose(val){
            }
        },
        mounted() {
            this.getProductWork();
        },
        //生命周期 - 创建之前
        beforeCreate() {},
        //生命周期 - 挂载之前
        beforeMount() {},
        //生命周期 - 更新之前
        beforeUpdate() {},
        //生命周期 - 更新之后
        updated() {},
        //生命周期 - 销毁之前
        beforeDestroy() {},
        //生命周期 - 销毁完成
        destroyed() {},
        //如果页面有keep-alive缓存功能，这个函数会触发
        activated() {},
    }
</script>

<style>

  .el-submenu__title{
    font-family: MicrosoftYaHei;
    font-size: 16px;
    font-weight: normal;
    font-stretch: normal;
    letter-spacing: -1px;
    color: #222222;
  }

.el-submenu{
    text-align: left !important;
    border-radius: 10px;
    box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.03), 0px 3px 7px 0px rgba(0, 0, 0, 0.25);
    margin: 10px;
}
.types .el-submenu{
    box-shadow: none;
}
.lefttitle{
    font-family: MicrosoftYaHei;
	font-size: 16px;
	font-weight: normal;
	font-stretch: normal;
	letter-spacing: -1px;
}
.lefttitle:focus, .lefttitle:hover{
    color: #425383;
}
.protitle{
    font-family: MicrosoftYaHei;
	font-size: 22px;
	font-weight: normal;
	font-stretch: normal;
	letter-spacing: -1px;
	color: #222222;
}
.titlecribe{
    height: 30px;
    line-height: 40px;
    font-family: MicrosoftYaHei;
	font-size: 22px;
	font-weight: normal;
	font-stretch: normal;
	letter-spacing: -1px;
	color: #409EFF;
    text-align: left;
    padding-left: 10px;
}
.el-divider--horizontal{
    margin: 10px 0;
}
.el-submenu .el-menu-item{
    min-width: 50px;
    padding: 0;
    padding-left: 20px !important;
    text-align: left
}
.probanner{
    background-image: url('../assets/img/compent/productbanner.png');
    height: 300px;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

</style>
